/*
 * Project: BoboDesignPattern
 * 
 * File Created at 2020年1月4日
 * 
 * Copyright 2012 Greenline.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Greenline Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Greenline.com.
 */
package test.practice;

import java.util.Arrays;

/**
 * @Type A20200104_bubblesort
 * @Desc
 * @author 52489
 * @date 2020年1月4日
 * @Version V1.0
 */
public class A20200104_bubblesort {

    public static void main(String[] args) {
        int[] nums = { 3, 1, 2, 7, 5, 4 };
        bubblesort(nums);
        System.out.println(Arrays.toString(nums));

    }

    /**
     * @param nums
     */
    private static void bubblesort(int[] nums) {
        for (int i = 0; i < nums.length; i++) {
            for (int j = 0; j < nums.length - i - 1; j++) {
                if (nums[j + 1] < nums[j]) {
                    int tmp = nums[j + 1];
                    nums[j + 1] = nums[j];
                    nums[j] = tmp;
                }
            }
        }
    }

}
